<template>
  <div class="app-container">
    <div class="table-btn">
      <el-button type="primary" size="small" icon="el-icon-plus" @click="addTeam()">添加</el-button>
      <el-dialog :title="dialogTitle" :visible.sync="outerVisible" width="700px" @close="closeDialog">
        <el-form label-width="110px">
          <el-form-item label="账目类型" size="small">
            <el-select v-model="accountType" placeholder="请选择">
              <el-option
                v-for="item in accountTypeList"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
        </el-form>
        <component :is="accountType" keep-alive :outer-visible="outerVisible" @closeDialog="closeDialog"></component>
      </el-dialog>
    </div>
  </div>
</template>

<script>
  import costproject from './components/costproject'
  import invoice from './components/invoice'
  import projectcontrac from './components/projectcontrac'
  import tenderdeposit from './components/tenderdeposit'
  import projectdeposit from './components/projectdeposit'
  import tendercompensation from './components/tendercompensation'
  import currentaccount from './components/currentaccount'
  import otherfees from './components/otherfees'

  export default {
    components: {
      costproject,
      invoice,
      projectcontrac,
      tenderdeposit,
      projectdeposit,
      tendercompensation,
      currentaccount,
      otherfees
    },
    data() {
      return {
        dialogTitle: '新增账目',
        outerVisible: false,
        accountType: 'costproject',
        accountTypeList: [
          { value: 'costproject', label: '成本支出' },
          { value: 'invoice', label: '开票管理' },
          { value: 'projectcontrac', label: '项目到账' },
          { value: 'tenderdeposit', label: '投标保证金管理' },
          { value: 'projectdeposit', label: '履约保证金管理' },
          { value: 'tendercompensation', label: '投标补偿金' },
          { value: 'currentaccount', label: '往来账' },
          { value: 'otherfees', label: '其他到账' }
        ]
      }
    },
    created() {
    },
    computed: {
      global() {
        return global
      }
    },
    methods: {
      addTeam() {
        this.outerVisible = true
        this.dialogTitle = '新增账目'
      },
      closeDialog() {
        this.outerVisible = false
        console.log(this.outerVisible)
      }
    }
  }
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  .app-container {
    .el-pagination {
      margin-top: 20px;
    }
    .table-btn {
      margin-bottom: 10px;
      & > button {
        margin: 0 20px;
      }
      .el-dialog {
        textarea {
          margin-top: 10px;
        }
        .el-checkbox {
          margin-right: 20px;
        }
        .el-checkbox + .el-checkbox {
          margin-left: 0;
        }
      }
    }
  }

</style>


<style rel="stylesheet/scss" lang="scss">
  .el-input__icon {
    line-height: 100%;
  }

  .el-form-item__content {
    line-height: 33px;
  }

  .area-select .area-selected-trigger {
    padding: 0 10px;
  }

  /*.el-table__body tr.hover-row>td {
    background-color: #0000ff !important;
  }

  .el-table__body tr.current-row>td {
    background-color: #0000ff !important;
  }*/
</style>
